<div class="content_filtro">
    <div class="filtro">
        <form id="form_filtro" method="post" action="">
            <i>Pesquisar</i>
            
            <div class="row">
                <?php

                    $query = 'SELECT SQL_CACHE ALU_ID,ALU_NOM FROM ALUNO WHERE ALU_STA = 1';
                    $f_cur = $this->db->fetchAll($query);

                    $html = '<select id="itfiltro" style="width: 362px;" name="itfiltro" class="chosen-select" >';
                    $html .= '<option value="">Todos Alunos</option>';
                    foreach($f_cur as $r){   
                        
                        if($this->PER_ID != 8) $nome = $r['ALU_NOM']; 
                        else $nome = $r['ALU_ID']; 
                        
                        $select = $this->itfiltro == $r['ALU_ID'] ? 'selected':''; 
                        $html .= '<option '.$select.' value="'.$r['ALU_ID'].'">'.$nome.'</option>';
                    }
                    $html .= '</select>';
                    echo $html;
                ?>
            </div>
            
            <div class="row">
                <input type="text" name="dsfiltro" placeholder="Arquivo" value="<?php echo $this->dsfiltro?>" />

                <input type="submit" class="btn-pdr" name="buscar" value="buscar" />
            </div>
        </form>
    </div>
    
    
</div>

<div class="content-list">
    
    <h2><?php echo $this->titulo;?></h2>
    
    <table id="tlist">
        <thead>
            <tr>
                <th>Data</th>
                <th>Aluno</th>
                <th>Arquivo</th>
                <th class="bc">&nbsp;</th>
            </tr>
        </thead>
        <tbody>
            <?php foreach ($this->result as $row) { 
                $link = glob('public/upload/enviodearquivo/'.$row['EVA_ID'].'A.*');
                $link = isset($link[0]) ? $link[0]:'';
                
                $nome_arq = '';
                if(strlen($link) > 0){
                    $nome_arq = $row['EVA_ID'].'A.'.end(explode('.', $link));
                }
            ?>
                <tr>
                    <td><?php echo Datetools::invertDH_D($row['EVA_DATHOR']); ?></td>
                    <td><?php 
                        if($this->PER_ID != 8) echo $row['ALU_NOM']; 
                        else echo $row['ALU_ID']; 
                    ?></td>
                    <td><?php echo $nome_arq; ?></td>
                    <td class="bc">
                        <?php if($this->per_edt){?><a class="btn-pdr" target="_blank" href="<?php echo $this->urlbase.'/'.$link; ?>">Redação</a><?php }?>
                        <?php if($this->per_edt){?><a class="btn-pdr" href="<?php echo $this->url(array('controller' => 'enviodearquivocorrecao', 'action' => 'index', 'eva_id' => $row['EVA_ID'])); ?>">Correção</a><?php }?>
                        <?php if($this->per_del && $row['EVA_STA'] == 0){?><a class="btn-pdr" href="javascript:void(0);" onclick="list_delete('<?php echo $this->controller; ?>', <?php echo $row['EVA_ID'] ?>, $(this));">Deletar</a><?php }?>
                    </td>
                </tr>
            <?php } ?>
        </tbody>
    </table>
</div>
<?php echo $this->paginationControl($this->paginator, 'Sliding', 'pagination.phtml'); ?>
